package com.jzo2o.customer.controller.agency;

import com.jzo2o.customer.model.dto.AgencyCertificationUpdateDTO;
import com.jzo2o.customer.model.dto.response.RejectReasonResDTO;
import com.jzo2o.customer.service.IAgencyCertificationAuditService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author SpongeBob
 */
@RestController
@RequestMapping("/agency/agency-certification-audit")
@Api(tags = "机构端 - 机构实名认证申请相关接口")
@RequiredArgsConstructor
public class AgencyCertificationAuditController {
    private final IAgencyCertificationAuditService agencyCertificationAuditService;

    /**
     * 机构提交认证申请
     *
     * @param agencyCertificationUpdateDTO 机构认证信息
     */
    @PostMapping
    @ApiOperation("机构提交认证申请")
    public void addAgencyCertificationAudit(@RequestBody AgencyCertificationUpdateDTO agencyCertificationUpdateDTO) {
        agencyCertificationAuditService.saveAgency(agencyCertificationUpdateDTO);

    }

    /**
     * 查询最新的驳回原因
     *
     * @return 最新的驳回原因
     */
    @GetMapping("/rejectReason")
    @ApiOperation("查询最新的驳回原因")
    public RejectReasonResDTO queryCurrentUserLastRejectReason() {
        return agencyCertificationAuditService.queryCurrentUserLastRejectReason();
    }
}
